package com.auto.api.framework.interceptor.impl;

import com.auto.api.framework.entity.ReqParamBO;
import com.auto.api.framework.interceptor.IAspectService;
import org.aspectj.lang.JoinPoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @author liangshf
 * @version 创建时间：2019年9月10日
 */
@Component("controllerAspectService")
public class ControllerAspectServiceImpl implements IAspectService {

    public static final Logger logger = LoggerFactory.getLogger(ControllerAspectServiceImpl.class);

    /**
     * Controller切面服务 执行目标方法后执行不需要返回值
     *
     * @param point 切点
     * @return object
     * @throws Throwable 异常信息
     */
    @Override
    public Object invoke(JoinPoint point) {
        Object[] args = point.getArgs();
        ReqParamBO paramBO = new ReqParamBO(point, args);
        logger
            .error("执行类:{},方法名:{}错误,入参: {}", paramBO.getClassName(), paramBO.getMethodName(), paramBO.getParamToJson());
        return null;
    }

}